# standard python importsimport osimport numpy as npimport gdstkimport time# # plot librariesimport matplotlib.pyplot as pltimport plotly.graph_objects as goimport plotly.io as pioimport plotly.express as px# pio.templates.default = "simple_white"pio.templates.default ="plotly_dark"pio.renderers.default ="notebook"# tidy3d importimport tidy3d as tdfrom tidy3d import web# users packagesfrom metasruface import make_wings, make_wings_array, make_diabolo, make_diabolo_arrayfrom utility import plot_gdscellfrom material.THzMaterial import diamond_thz_nd, silica_thz_nd, pdms10_thz_ndFLOAT_MIN =4.9406564584124654E-324
Draw the Metasurface in GDS
Code
ncol_ms =11# array sizenrow_ms =11d_ms =25.0# bridge widthl_ms =135.0# unit sizep_ms =270.0# periodicity s_ms =-25.0# separation between two trianglestheta_ms =50.0# flare angle [deg]l_magbox = d_ms/np.tan(theta_ms/2.0/180*np.pi)+s_msld_thz_ms = ld_thz_ms= {"layer": 11, "datatype": 1}cell = make_wings(d_ms, l_ms, p_ms, s_ms, theta_ms, **ld_thz_ms)cellcell = make_wings_array(ncol_ms, nrow_ms, d_ms, l_ms, p_ms, s_ms, theta_ms, **ld_thz_ms)um_gds =1E-6gdslib = gdstk.Library()gdslib.unit = um_gdsgdslib.add(cellcell, *cellcell.dependencies(True))filename =f"temp_{20240802}.gds"gdslib.write_gds(f"gds_output/{filename}")# Load a GDSII library from the file we just createdgds_path =f"gds_output/{filename}"lib_loaded = gdstk.read_gds(gds_path)# Create a cell dictionary with all the cells in the fileall_cells = {c.name: c for c in lib_loaded.cells}print("Cell names: "+", ".join(all_cells.keys()))cell_loaded = all_cells["Wings"]print(cell_loaded)plot_gdscell(cell_loaded)
Cell names: Diabolo Array, Wings
Cell 'Wings' with 2 polygons, 0 flexpaths, 0 robustpaths, 0 references, and 0 labels
Simulation Setting and Visualization
Code
# define freqeunecy rangeGHz =1e9# 1 GHz = 1e9 Hzfreq0 =400.0* GHz # central frequencyfreqs = np.linspace(freq0-200.0*GHz, freq0+400.0* GHz, 500) # frequency range of interestfwidth =0.5* (np.max(freqs) - np.min(freqs)) # width of the source spectrumlda0 = td.C_0 / freq0 # central wavelength# define structure geometric parameterst_sub =180.0#umt_diabolo =0.15t_magbox =8.0t_magbox_open =3.5t_rfstrip =1.0w_rfstrip =100.0t_uf =60.0t_ufch =30.0# define material properties, assume non-dispersive dielectricsigma_copper =42# copper conductivity in S/um, ref DOI:10.1109/TTHZ.2015.2468074t_copper = t_diabolocopper3D = td.Medium(conductivity=sigma_copper)copper2D_thz = td.Medium2D.from_medium(copper3D, thickness=t_diabolo) # define copper as a Medium2Dcopper2D_rf = td.Medium2D.from_medium(copper3D, thickness=t_rfstrip) # define copper as a Medium2Dsub_medium = silica_thz_nd # define substrate mediummsbox_medium = diamond_thz_nd # define medium in MS boxuf_medium = pdms10_thz_nd # define microfluidic medium